<?php
include_once '../header1.php';
?>
<link rel="stylesheet" href="../css/datepicker.css" type="text/css" />
    <link rel="stylesheet" media="screen" type="text/css" href="../css/layout.css" />
  	<script type="text/javascript" src="../js/jquery.js"></script>
	<script type="text/javascript" src="../js/datepicker.js"></script>
    <script type="text/javascript" src="../js/eye.js"></script>
    <script type="text/javascript" src="../js/utils.js"></script>
    <script type="text/javascript" src="../js/layout.js?ver=1.0.2"></script>
<script type="text/javascript">
function getHttpRequest()
{
if(window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
else
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
return xmlhttp;
}
</script>
<script type="text/javascript">
function DeleteVerification(rownum,variables)
{
	var rownum=rownum;
	var id="Verifi";
var r=confirm("Are you sure to delete this?");
if(r==true)
{
document.getElementById(id).value=variables;
}
}
</script>
<script type="text/javascript">
function GetTBox(tbox,rows)
{
	var i;
	var box="groupcolumn"+tbox;
	for(i=1;i<=rows;i++)
	{
		var tb="groupcolumn"+i;
		var b="button"+i;
		if(tb!=box)
		{
		document.getElementById(tb).value="";
		document.getElementById(b).innerHTML="";
		}
	}
	
}
</script>
<script type="text/javascript">
function GetCol(val,name,rownum)
{
	var rownum=rownum;
	var xmlhttp; 
var b="button"+rownum;
var n=val+","+rownum+","+name;
if (val=="")
  {
  document.getElementById(b).innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest();
  }
else
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
   document.getElementById(b).innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","butt.php?q="+n,true);
xmlhttp.send();
}
</script>
</head>
<body>
<?php

include_once ("../Login/databaseconnection.php");
if(!loggedin())
{
require_once ("../index.php");
}
   
   else
   {
   $action="";
    if(!isset($_POST['gby'])&&!isset($_POST['groupback']))
  {
	   $_SESSION['sele_groupby']="";
	   $_SESSION['back_groupby']=0;	
 $_SESSION['Column_name']="";	
$_SESSION['gvals']=""; 
}	   
	   $action="";
  if(isset($_POST['gby']))
  {
	  $action="group";
	 $crvalues=$_POST['crval'];
	 $crvalu=explode(",",$crvalues);
	 $Column=$crvalu[0];
	 $rownum=$crvalu[1];
         $pri_keys=$_POST['pri'];
	 $prikeys=explode(",",$pri_keys);
	$Serial_Number=$prikeys[0];
	$Resource_Id=$prikeys[1];
    	 if(empty($_SESSION['sele_groupby']))
	  {
		 $_SESSION['sele_groupby']=$pri_keys.",".$Column;
	  }
	  else
	  {
		 $_SESSION['sele_groupby']=$_SESSION['sele_groupby']."_".$pri_keys.",".$Column;
	  } 
	  
$sele_groupby=explode("_",$_SESSION['sele_groupby']);
if($Column==1)
{
if(empty( $_SESSION['Column_name']))
{
 $_SESSION['Column_name']="Serial_Number";
}
else
{
 $_SESSION['Column_name']= $_SESSION['Column_name'].",Serial_Number";
}
}
if($Column==2)
{
if(empty( $_SESSION['Column_name']))
{
$_SESSION['Column_name']="Functioning";
}
else
{
$_SESSION['Column_name']= $_SESSION['Column_name'].",Functioning";
}
}
if($Column==3)
{
if(empty( $_SESSION['Column_name']))
{
 $_SESSION['Column_name']="Brand_Name";
}
else
{
 $_SESSION['Column_name']= $_SESSION['Column_name'].",Brand_Name";
}
}
if($Column==4)
{
if(empty( $_SESSION['Column_name']))
{
 $_SESSION['Column_name']="Date_Of_Supplied";
}
else
{
 $_SESSION['Column_name']= $_SESSION['Column_name'].",Date_Of_Supplied";
}
}
 if($Column==5)
{
if(empty( $_SESSION['Column_name']))
{
 $_SESSION['Column_name']="Name_Of_Supplier";
}
else
{
 $_SESSION['Column_name']= $_SESSION['Column_name'].",Name_Of_Supplier";
}
}
if($Column==6)
{
if(empty( $_SESSION['Column_name']))
{
 $_SESSION['Column_name']="Funding_Source";
}
else
{
$_SESSION['Column_name']= $_SESSION['Column_name'].",Funding_Source";
}
}
if($Column==7)
{
if(empty( $_SESSION['Column_name']))
{
 $_SESSION['Column_name']="Resource_Id";
}
else
{
 $_SESSION['Column_name']= $_SESSION['Column_name'].",Resource_Id";
}
}
if($Column==8)
{
if(empty( $_SESSION['Column_name']))
{
 $_SESSION['Column_name']="Lab_Id";
}
else
{
 $_SESSION['Column_name']= $_SESSION['Column_name'].",Lab_Id";
}
}
if($Column==9)
{
if(empty( $_SESSION['Column_name']))
{
 $_SESSION['Column_name']="School_Id";
}
else
{
 $_SESSION['Column_name']= $_SESSION['Column_name'].",School_Id";
}
}
if($Column==10)
{
if(empty( $_SESSION['Column_name']))
{
 $_SESSION['Column_name']="Resource_Id";
}
else
{
 $_SESSION['Column_name']= $_SESSION['Column_name'].",Resource_Id";
}
}
if($Column==11)
{
if(empty( $_SESSION['Column_name']))
{
 $_SESSION['Column_name']="Last_Updated_Date";
}
else
{
 $_SESSION['Column_name']= $_SESSION['Column_name'].",Last_Updated_Date";
}
}

  $Column_names=explode(",", $_SESSION['Column_name']);
  $tot_cols=count($Column_names);
		$Exc_que="SELECT * FROM resource_details WHERE Serial_Number='".$Serial_Number."' AND Resource_Id='".$Resource_Id."'";
 $gro=mysql_query("SELECT * FROM resource_details WHERE Serial_Number='".$Serial_Number."' AND Resource_Id='".$Resource_Id."'");
   $number_of_rows=mysql_num_rows($gro);
if($rowgro=mysql_fetch_array($gro))
{
$Col_name= $Column_names[$tot_cols-1];
if($rowgro[$Col_name]=="")
{
$_SESSION['value_empty']="Sorry,the column value is empty";
}
else
{
if(empty($_SESSION['gvals']))
{
$_SESSION['gvals']=$rowgro[$Col_name];
}
else
{
$_SESSION['gvals']=$_SESSION['gvals'].",".$rowgro[$Col_name];
}
}
}
	}  
   if(isset($_POST['groupback']))
  {
	  $sele_groupby=explode("_",$_SESSION['sele_groupby']);
	 $_SESSION['back_groupby']=$_SESSION['back_groupby']+1;
	 $gval=explode(",",$_SESSION['gvals']);	 
  $Column_names=explode(",",$_SESSION['Column_name']);
   $Columns="";
   $Vals="";
  for($b=0;$b<count($Column_names)-1;$b++)
  { 
   if(empty($Vals))
  {
  $Vals=$gval[$b];
  }
  else
  {
  $Vals=$Vals.",".$gval[$b];
  }
   if(empty($Columns))
  {
  $Columns=$Column_names[$b];
  }
  else
  {
  $Columns=$Columns.",".$Column_names[$b];
  }
  }
  $_SESSION['gvals']=$Vals;
$_SESSION['Column_name']=$Columns;

  $gval=explode(",",$_SESSION['gvals']);
  $Column_names=explode(",",$_SESSION['Column_name']);  	 
    if($_SESSION['Access_Type']=="Administrator")
  {
   if($_SESSION['Column_name']=="")
  {
   $res_que="SELECT * FROM resource_details";
     }
 else
  {
   $res_que="SELECT * FROM resource_details WHERE ";
     for($j=0;$j<count($Column_names);$j++)
  {
  $Col_name=$Column_names[$j];
     $res_que=$res_que.$Col_name."='".$gval[$j]."'";
   if($j!=(count($Column_names)-1))
  {
  $res_que=$res_que." AND ";
  }
  }
  }
    $resultgro=mysql_query($res_que);
	$Exc_que=$res_que;
   $number_of_rows=mysql_num_rows($resultgro);
    }
 else if($_SESSION['Access_Type']=="Teacher in Charge"||$_SESSION['Access_Type']=="Teacher")
  {
  $NIC_Number=$_SESSION['NIC_Number'];
   $get_Sch=mysql_query("SELECT * FROM teacher WHERE T_NIC_Number='$NIC_Number'");
   if($rowsch=mysql_fetch_array($get_Sch))
{
   $Own_School_Id=$rowsch['School_Id'];
   }
  if($_SESSION['Column_name']=="")
  {
   $res_que="SELECT * FROM resource_details WHERE School_Id='".$Own_School_Id."'";
     }
  else
  {
   $res_que="SELECT * FROM resource_details WHERE ";
    for($j=0;$j<count($Column_names);$j++)
  {
  $Col_name=$Column_names[$j];
  
    $res_que=$res_que.$Col_name."='".$gval[$j]."'";
   if($j!=(count($Column_names)-1))
  {
  $res_que=$res_que." AND ";
  }
  if($j==(count($Column_names)-1))
  {
  $res_que=$res_que." AND School_Id='".$Own_School_Id."'";
  }
  }
  }
     $resultgro=mysql_query($res_que);
	 $Exc_que=$res_que;
   $number_of_rows=mysql_num_rows($resultgro);
     }
  }
    if(isset($_POST['dele']))
  {
   $action="delete";
   }
   ?>
<?php
include_once "../header2.php";
?>
<?php
include_once "topmenu.php";
?>
<div id="content">
	<div id="main">
	  <div id="bodyfield">
<br/>
<?php
if($action=="delete")
{
$dvari=$_POST['Verifi'];
if($dvari!="")
{
$vari=explode(",",$dvari);
$Serial_Number=$vari['0'];
$Resource_Id=$vari['1'];
}
if($dvari!="")
{
if($_SESSION['Access_Type']=="Administrator")
{
$resultdel=mysql_query("DELETE FROM resource_details WHERE Serial_Number='".$Serial_Number."' AND Resource_Id='".$Resource_Id."'");
if(mysql_affected_rows()!=0)
{
$_SESSION['del']="Successfully deleted!";
}
if(mysql_affected_rows()==0)
{
$_SESSION['del']="Sorry unable to delete this!";
}
}
else if($_SESSION['Access_Type']=="Teacher in Charge")
{
	$result=mysql_query("SELECT * FROM resource_details WHERE Serial_Number='".$Serial_Number."' AND Resource_Id='".$Resource_Id."'");
	$Accessed_By=$_SESSION['NIC_Number'];
	date_default_timezone_set("Europe/Paris");
    $t_d=date("Y/m/d");
	if($row=mysql_fetch_array($result))
   {
   $Resource_Id=$row['Resource_Id'];
   $Lab_Id=$row['Lab_Id'];
   $Serial_Number=$row['Serial_Number'];
   $Functioning=$row['Functioning'];
   $Brand_Name=$row['Brand_Name'];
   $Date_Of_Supplied=$row['Date_Of_Supplied'];
   $Name_Of_Supplier=$row['Name_Of_Supplier'];
   $Funding_Source=$row['Funding_Source'];
   $School_Id=$row['School_Id'];
   $Last_Updated_Date=$row['Last_Updated_Date'];  
   }
  	 $sql=mysql_query("INSERT INTO deleted_resource_details(Resource_Id,Lab_Id,Serial_Number,Functioning,Brand_Name,Date_Of_Supplied,Name_Of_Supplier,Funding_Source,School_Id,Deleted_date,Accessed_By,Last_Updated_Date) VALUES('$Resource_Id','$Lab_Id','$Serial_Number','$Functioning','$Brand_Name','$Date_Of_Supplied','$Name_Of_Supplier','$Funding_Source','$School_Id','$t_d','$Accessed_By','$Last_Updated_Date')");
if($sql)
{
    $del=mysql_query("DELETE FROM resource_details WHERE Serial_Number='".$Serial_Number."' AND Resource_Id='".$Resource_Id."'");
	if(mysql_affected_rows()!=0)
  {
$_SESSION['del']="This record is successfully deleted!";
  }
  if(mysql_affected_rows()==0)
  {
 $_SESSION['del']="Sorry unable to delete this record!";
 mysql_query("DELETE FROM deleted_resource_details WHERE Resource_Id='".$Resource_Id."' AND Deleted_Date='".$t_d."' AND Serial_Number='".$Serial_Number."'");
  }
  }
    if(!$sql)
{
 $_SESSION['del']="Sorry unable to delete this record!";
 }
}
}
}
echo '<form  action="#" method="POST">';
echo "<input type='hidden' size='1' id='Verifi' name='Verifi'/>";
echo '<br/>';
 
if($_GET['action']=="edit"&&$action!="delete"&&$action!="group"&&!isset($_POST['groupback'])&&$_SESSION['Access_Type']!="Teacher")
	{
$Serial_Number=$_GET['Serial_Number'];
$Resource_Id=$_GET['Resource_Id'];
$result=mysql_query("SELECT * FROM resource_details WHERE Serial_Number='".$Serial_Number."' AND Resource_Id='".$Resource_Id."'");
if($result)
   {
$qucol="SHOW COLUMNS FROM resource_details";
$resultcol=mysql_query($qucol);
$totcol=mysql_num_rows($resultcol);
while($rowcolu=mysql_fetch_row($resultcol))
{
if($rowcolu[0]!="Last_Updated_Date")
{
if(empty($colnamearray))
{
$colnamearray=$rowcolu[0];
}
else
{
$colnamearray=$colnamearray.",".$rowcolu[0];
}
}
}
$colnamearray=$colnamearray.",Resource Name";
$colnamearray=$colnamearray.",Last_Updated_Date";


	$cnamearray=explode(",",$colnamearray);
    if(!isset($_POST['Go']))
	 {
	 echo '<table class="tablefontv">';
	if($row=mysql_fetch_array($result))
  {
 $cnamearray=explode(',',$colnamearray);
    for($cv=0;$cv<count($cnamearray);$cv++)
	{
	$val=$cnamearray[$cv];
	if($val=="Resource_Id")
	{
	$Re_ID=$row[$val];
	}
	
	  $th_cname= str_replace("_"," ",$val);
		$valu=$row[$val];
		if($val!="Last_Updated_Date"&&$val!="Resource Name"&&$val!="Functioning")
		{
    echo '<tr>';
        echo '<th width="200" height="29" scope="row" bgcolor="#3399CC">';
		echo $th_cname.":";
		echo '</th>';
        echo '<td width="144">';
		echo "<input type='text' name='$val' value='$valu'>";
		echo '</td>';
      echo '</tr>';
	  }
	}
}
	  echo '</table>';
	  echo '<br/>';
	   echo '<input name="Go" align="middle" type="submit" value="Go" class="gobutton"/>';	
	   }
	   if(isset($_POST['Go']))
	   {
	$Resource_Id1=$_POST['Resource_Id'];
$Lab_Id=$_POST['Lab_Id'];
   $Serial_Number1=$_POST['Serial_Number'];
    $Brand_Name=$_POST['Brand_Name'];
    $Date_Of_Supplied=$_POST['Date_Of_Supplied'];
    $Name_Of_Supplier=$_POST['Name_Of_Supplier'];
    $Funding_Source=$_POST['Funding_Source'];
	$School_Id=$_POST['School_Id'];
  date_default_timezone_set("Europe/Paris");
    $t_d=date("Y/m/d");
	
$up=mysql_query("UPDATE resource_details SET Resource_Id='$Resource_Id1',Lab_Id='$Lab_Id',Serial_Number='$Serial_Number1',Brand_Name='$Brand_Name',Date_Of_Supplied='$Date_Of_Supplied',Name_Of_Supplier='$Name_Of_Supplier',Funding_Source='$Funding_Source',School_Id='$School_Id',Last_Updated_Date='$t_d' WHERE Resource_Id='$Resource_Id' AND Serial_Number='$Serial_Number'");
 if(!$up)
	   {
	   $_SESSION['up']="Sorry unable to edit this please try again!";
	   }
	   	   if($_SESSION['Access_Type']=="Teacher"||$_SESSION['Access_Type']=="Teacher in Charge")
	{
	$T_NIC_Number=$_GET['T_NIC_Number'];
	$NIC_Number=$_SESSION['NIC_Number'];
   $get_Sch=mysql_query("SELECT * FROM teacher WHERE T_NIC_Number='$NIC_Number'");
   if($rowsch=mysql_fetch_array($get_Sch))
{
   $Own_School_Id=$rowsch['School_Id'];
    $result=mysql_query("SELECT * FROM resource_details WHERE School_Id='$Own_School_Id'");
	$Exc_que="SELECT * FROM resource_details WHERE School_Id='$Own_School_Id'";
   $number_of_rows=mysql_num_rows($result);
  }
  }
	else if($_SESSION['Access_Type']=="Administrator")
	{
	 $result=mysql_query("SELECT * FROM resource_details");
	$Exc_que="SELECT * FROM resource_details";
   $number_of_rows=mysql_num_rows($result);
	 }
if(mysql_num_rows($result)!=0)
   {
   $rnum=0;  
   if(mysql_num_rows($result)>=10)
   {
	 echo '<div style="height:410px; overflow-Y:scroll; ">';
	 }
  echo '<table width="937" border="1" class="tablefontv">';
  	if($result)
  {
echo '<tr bgcolor="#6AB5FF">';
		if($_SESSION['Access_Type']=="Administrator"||$_SESSION['Access_Type']=="Teacher in Charge")
	{
echo '<td width="39"></td>
<td width="39"></td>';
}
$cnamearray=explode(',',$colnamearray);
    for($cv=0;$cv<count($cnamearray);$cv++)
	{
	$val=$cnamearray[$cv];
if($val=="Resource_Id")
	{
	$Re_ID=$row[$val];
	}
	 $th_cname= str_replace("_"," ",$val);
		
	$valu=$row[$val];
         echo '<td>';
		if($val=="School_Id")
  {
    $cnu=$cv+1;
	echo "(".$cnu.")School Name";
  }
  else if($val=="Lab_Id")
  {
    $cnu=$cv+1;
	echo "(".$cnu.")Lab Type";
  }
  else
  {
	$cnu=$cv+1;
	echo "(".$cnu.")".$th_cname;
  }
		echo '</td>';
    }
		echo '<td width="159">Column No</td>';
	echo '</tr>';
}

  while($row=mysql_fetch_array($result))
  {
	  $rnum=$rnum+1;
$s=$row['Serial_Number'];
$r=$row['Resource_Id'];

$delVerification="delVerification".$rnum;
$name=$s.",".$r;
?>
<tr bgcolor="#999999"><?php echo "<form action='#' method='post'>";
   	if($_SESSION['Access_Type']=="Administrator"||$_SESSION['Access_Type']=="Teacher in Charge")
	{	?>
<td width="39">
<a href='?action=edit&Serial_Number=<?php echo $s; ?>&Resource_Id=<?php echo $r; ?>'><img src="../images/edit.png"/></a></td><td width="39"><?php echo "<input type='submit' id='$name' name='dele' onclick='DeleteVerification($rnum,this.id)' class='submitdelete' value=''/>";?></td>
	<?php 
	}
$cnamearray=explode(',',$colnamearray);
	for($cv=0;$cv<count($cnamearray);$cv++)
	{
	$val=$cnamearray[$cv];
	if($val=="Resource_Id")
	{
	$Re_ID=$row[$val];
	}
		if($val=="Lab_Id")
	{
	$L_ID=$row[$val];
	}
	  $th_cname= str_replace("_"," ",$val);
		
	$valu=$row[$val];
      	if($cv==9)
		{
		$resultnet=mysql_query("SELECT * FROM resource WHERE Resource_Id='$Re_ID'");
  if($rownet=mysql_fetch_array($resultnet))
  {  
    echo '<td>';
		echo $rownet['Resource_Type'];
		echo '</td>';	
  }
  else
  {
    echo '<td>';
		echo '';
		echo '</td>';	 
  }
		}
		else if($cv==7)
		{
		$resultl=mysql_query("SELECT * FROM lab WHERE Lab_Id='$L_ID'");
  if($rowl=mysql_fetch_array($resultl))
  {  
    echo '<td>';
		echo $rowl['Lab_Type'];
		echo '</td>';	
  }
  else
  {
    echo '<td>';
		echo '';
		echo '</td>';	 
  }
		}
		else
		{
      		if($val=="School_Id")
{
$get_Sch_name=mysql_query("SELECT * FROM school WHERE School_Id='".$valu."'");
if($rs=mysql_fetch_array($get_Sch_name))
{
$Name=$rs['Name'];
}
echo '<td>';
		echo $Name;
		echo '</td>';
}
else
{
            echo '<td>';
		echo $valu;
		echo '</td>';
		}
    	}
  
	}
	?>
	<td width="90">
    <?php
	 if($_SESSION['Access_Type']=="Teacher"||$_SESSION['Access_Type']=="Teacher in Charge")
	{
	 $NIC_Number=$_SESSION['NIC_Number'];
   $get_Sch=mysql_query("SELECT * FROM teacher WHERE T_NIC_Number='$NIC_Number'");
   if($rowsch=mysql_fetch_array($get_Sch))
{
   $Own_School_Id=$rowsch['School_Id'];
	   $resultte=mysql_query("SELECT * FROM resource_details WHERE School_Id='$Own_School_Id'");
	$Exc_que="SELECT * FROM resource_details WHERE School_Id='$Own_School_Id'";
   $number_of_rows=mysql_num_rows($resultte);
	   	       if($resultte)
  {
  if(mysql_num_rows($resultte)!=0)
  {
  $_SESSION['errornotallo']="Sorry you are not allowed to view all details!";
  }
  }
  $n=mysql_num_rows($resultte);
	}
	}
	else if($_SESSION['Access_Type']=="Administrator")
	{
		$resultte=mysql_query("SELECT * FROM resource_details");
	$Exc_que="SELECT * FROM resource_details";
   $number_of_rows=mysql_num_rows($resultte);
  $n=mysql_num_rows($resultte);
	}
    echo "<div class='ctxt'><input type='text' size='5' name='$name' id='$groupcolumn'  onkeyup='GetCol(this.value,this.name,$rnum)' onclick='GetTBox($rnum,$n)'/></div>";
	$button="button".$rnum;
		echo "<div id='$button' class='sub_but'></div>";
	?></td>
    <?php
  echo '</tr>';
  }
  
   echo "</table>";
   if(mysql_num_rows($result)>=10)
   {
	 echo '</div>';
	 }
     $Column_names=explode(",",$_SESSION['Column_name']);
   if(count($Column_names)>0&&$_SESSION['Column_name']!="")
  {
   ?>
   <br/>
   <form action="#"/>
   <input type="submit" name="groupback" class="groupback" value=""/></form>
   <?php
   }
  echo "</form>";
}
	   }
	}
	}
		else
	{
	if(isset($_POST['groupback']))
  {
     $rnum=0;
	if($resultgro)
	 {	  
$qucol="SHOW COLUMNS FROM resource_details";
$resultcol=mysql_query($qucol);
$totcol=mysql_num_rows($resultcol);
while($rowcolu=mysql_fetch_row($resultcol))
{
if($rowcolu[0]!="Last_Updated_Date")
{
if(empty($colnamearray))
{
$colnamearray=$rowcolu[0];
}
else
{
$colnamearray=$colnamearray.",".$rowcolu[0];
}
}
}
$colnamearray=$colnamearray.",Resource Name";
$colnamearray=$colnamearray.",Last_Updated_Date";

   if(mysql_num_rows($resultgro)>=10)
   {
	 echo '<div style="height:410px; overflow-Y:scroll; ">';
	 }
  echo '<table width="937" border="1" class="tablefontv">';
  echo '<tr bgcolor="#6AB5FF">';
		if($_SESSION['Access_Type']=="Administrator"||$_SESSION['Access_Type']=="Teacher in Charge")
	{
echo '<td width="39"></td>
<td width="39"></td>';
}
$cnamearray=explode(',',$colnamearray);
     for($cv=0;$cv<count($cnamearray);$cv++)
	{
	$val=$cnamearray[$cv];
	if($val=="Resource_Id")
	{
	$Re_ID=$row[$val];
	}
	$th_cname= str_replace("_"," ",$val);
	$valu=$row[$val];
        echo '<td>';
		if($val=="School_Id")
  {
    $cnu=$cv+1;
	echo "(".$cnu.")School Name";
  }
  else if($val=="Lab_Id")
  {
    $cnu=$cv+1;
	echo "(".$cnu.")Lab Type";
  }
  else
  {
	$cnu=$cv+1;
	echo "(".$cnu.")".$th_cname;
  }
		echo '</td>';
   
	}
	echo '<td width="159">Column No</td>';
	echo '</tr>';
while($row=mysql_fetch_array($resultgro))
  {
$rnum=$rnum+1;
   $s=$row['Serial_Number'];
$r=$row['Resource_Id'];
$delVerification="delVerification".$rnum;
$name=$s.",".$r;
?>
<tr bgcolor="#999999"><?php echo "<form action='#' method='post'>";
   	if($_SESSION['Access_Type']=="Administrator"||$_SESSION['Access_Type']=="Teacher in Charge")
	{	?>
<td width="39">
<a href='?action=edit&Serial_Number=<?php echo $s; ?>&Resource_Id=<?php echo $r; ?>'><img src="../images/edit.png"/></a></td><td width="39"><?php echo "<input type='submit' id='$name' name='dele' onclick='DeleteVerification($rnum,this.id)' class='submitdelete' value=''/>";?></td>
	<?php 
	}
	$cnamearray=explode(',',$colnamearray);
	for($cv=0;$cv<count($cnamearray);$cv++)
	{
	$val=$cnamearray[$cv];
	if($val=="Resource_Id")
	{
	$Re_ID=$row[$val];
	}
		if($val=="Lab_Id")
	{
	$L_ID=$row[$val];
	}
	  $th_cname= str_replace("_"," ",$val);
		
	$valu=$row[$val];
       	if($cv==9)
		{
		$resultnet=mysql_query("SELECT * FROM resource WHERE Resource_Id='$Re_ID'");
  if($rownet=mysql_fetch_array($resultnet))
  {  
    echo '<td>';
		echo $rownet['Resource_Type'];
		echo '</td>';	
  }
  else
  {
    echo '<td>';
		echo '';
		echo '</td>';	 
  }
		}
		else if($cv==7)
		{
		$resultl=mysql_query("SELECT * FROM lab WHERE Lab_Id='$L_ID'");
  if($rowl=mysql_fetch_array($resultl))
  {  
    echo '<td>';
		echo $rowl['Lab_Type'];
		echo '</td>';	
  }
  else
  {
    echo '<td>';
		echo '';
		echo '</td>';	 
  }
		}
		else
		{
   		if($val=="School_Id")
{
$get_Sch_name=mysql_query("SELECT * FROM school WHERE School_Id='".$valu."'");
if($rs=mysql_fetch_array($get_Sch_name))
{
$Name=$rs['Name'];
}
echo '<td>';
		echo $Name;
		echo '</td>';
}
else
{
            echo '<td>';
		echo $valu;
		echo '</td>';
		}
    	}
   
	}
	?>
	<td width="90">
	<?php
	if($_SESSION['Access_Type']=="Administrator")
	{
		$resultte=mysql_query("SELECT * FROM resource_details");
	$Exc_que="SELECT * FROM resource_details";
   $number_of_rows=mysql_num_rows($resultte);
  $n=mysql_num_rows($resultte);
	}
	else if($_SESSION['Access_Type']=="Teacher"||$_SESSION['Access_Type']=="Teacher in Charge")
	{
	 $NIC_Number=$_SESSION['NIC_Number'];
   $get_Sch=mysql_query("SELECT * FROM teacher WHERE T_NIC_Number='$NIC_Number'");
   if($rowsch=mysql_fetch_array($get_Sch))
{
   $Own_School_Id=$rowsch['School_Id'];
	   $resultte=mysql_query("SELECT * FROM resource_details  WHERE School_Id='$Own_School_Id'");
	$Exc_que="SELECT * FROM resource_details WHERE School_Id='$Own_School_Id'";
   $number_of_rows=mysql_num_rows($resultte);
	   	       if($resultte)
  {
  if(mysql_num_rows($resultte)!=0)
  {
  $_SESSION['errornotallo']="Sorry you are not allowed to view all details!";
  }
  }
  $n=mysql_num_rows($resultte);
	}
	}
    echo "<div class='ctxt'><input type='text' size='5' name='$name' id='$groupcolumn'  onkeyup='GetCol(this.value,this.name,$rnum)' onclick='GetTBox($rnum,$n)'/></div>";
	$button="button".$rnum;
		echo "<div id='$button' class='sub_but'></div>";
	?></td>
    <?php
  echo '</tr>';
  }
  }
   echo "</table>";
   if(mysql_num_rows($resultgro)>=10)
   {
	 echo '</div>';
	 }
   $Column_names=explode(",",$_SESSION['Column_name']);
   if(count($Column_names)>0&&$_SESSION['Column_name']!="")
  {
    ?>
   <br/>   
   <form action="#"/>
   <input type="submit" name="groupback" class="groupback" value=""/></form>
   <?php
   }
   echo "</form>";  
   }
   if(!isset($_POST['groupback']))
  {
	  if($_SESSION['Access_Type']=="Administrator")
{
$result=mysql_query("SELECT * FROM resource_details");
	$Exc_que="SELECT * FROM resource_details";
   $number_of_rows=mysql_num_rows($result);
}
else if($_SESSION['Access_Type']=="Teacher"||$_SESSION['Access_Type']=="Teacher in Charge")
	{
	 $NIC_Number=$_SESSION['NIC_Number'];
   $get_Sch=mysql_query("SELECT * FROM teacher WHERE T_NIC_Number='$NIC_Number'");
   if($rowsch=mysql_fetch_array($get_Sch))
{
   $Own_School_Id=$rowsch['School_Id'];
   $result=mysql_query("SELECT * FROM resource_details WHERE School_Id='$Own_School_Id'");
	$Exc_que="SELECT * FROM resource_details WHERE School_Id='$Own_School_Id'";
   $number_of_rows=mysql_num_rows($result);
   }
   }
if($result)
   {
    if(mysql_num_rows($result)==0)
   {
   $_SESSION['errornorow']="Sorry there is no result to view!";
   }
   if(mysql_num_rows($result)>0)
   {
   $rnum=0;
$qucol="SHOW COLUMNS FROM resource_details";
$resultcol=mysql_query($qucol);
$totcol=mysql_num_rows($resultcol);
while($rowcolu=mysql_fetch_row($resultcol))
{
if($rowcolu[0]!="Last_Updated_Date")
{
if(empty($colnamearray))
{
$colnamearray=$rowcolu[0];
}
else
{
$colnamearray=$colnamearray.",".$rowcolu[0];
}
}
}
$colnamearray=$colnamearray.",Resource Name";
$colnamearray=$colnamearray.",Last_Updated_Date";


 if($action!="group")
  {
   if(mysql_num_rows($result)>=10)
   {
	 echo '<div style="height:410px; overflow-Y:scroll; ">';
	 }
    echo '<table width="937" border="1" class="tablefontv">';
  echo '<tr bgcolor="#6AB5FF">';
		if($_SESSION['Access_Type']=="Administrator"||$_SESSION['Access_Type']=="Teacher in Charge")
	{
echo '<td width="39"></td>
<td width="39"></td>';
}
$cnamearray=explode(',',$colnamearray);
     for($cv=0;$cv<count($cnamearray);$cv++)
	{
	 $val=$cnamearray[$cv];
	if($val=="Resource_Id")
	{
	$Re_ID=$row[$val];
	}
	  $th_cname= str_replace("_"," ",$val);
		
	$valu=$row[$val];
  echo '<td>';
		if($val=="School_Id")
  {
    $cnu=$cv+1;
	echo "(".$cnu.")School Name";
  }
  else if($val=="Lab_Id")
  {
    $cnu=$cv+1;
	echo "(".$cnu.")Lab Type";
  }
  else
  {
	$cnu=$cv+1;
	echo "(".$cnu.")".$th_cname;
  }
		echo '</td>';
   
	}
	echo '<td width="159">Column No</td>';
	echo '</tr>';
  while($row=mysql_fetch_array($result))
  {
	  $rnum=$rnum+1;
    
$s=$row['Serial_Number'];
$r=$row['Resource_Id'];
$delVerification="delVerification".$rnum;
$name=$s.",".$r;
?>
<tr bgcolor="#999999"><?php echo "<form action='#' method='post'>";
   	if($_SESSION['Access_Type']=="Administrator"||$_SESSION['Access_Type']=="Teacher in Charge")
	{	?>
<td width="39">
<a href='?action=edit&Serial_Number=<?php echo $s; ?>&Resource_Id=<?php echo $r; ?>'><img src="../images/edit.png"/></a></td>
<td width="39"><?php echo "<input type='submit' id='$name' name='dele' onclick='DeleteVerification($rnum,this.id)' class='submitdelete' value=''/>";?></td>
	<?php 
	}
	$cnamearray=explode(',',$colnamearray);
	for($cv=0;$cv<count($cnamearray);$cv++)
	{
	$val=$cnamearray[$cv];
	if($val=="Resource_Id")
	{
	$Re_ID=$row[$val];
	}
	if($val=="Lab_Id")
	{
	$L_ID=$row[$val];
	}
		  $th_cname= str_replace("_"," ",$val);
		$valu=$row[$val];
		if($cv==9)
		{
		$resultnet=mysql_query("SELECT * FROM resource WHERE Resource_Id='$Re_ID'");
  if($rownet=mysql_fetch_array($resultnet))
  {  
    echo '<td>';
		echo $rownet['Resource_Type'];
		echo '</td>';	
  }
  else
  {
    echo '<td>';
		echo '';
		echo '</td>';	 
  }
		}
		else if($cv==7)
		{
		$resultl=mysql_query("SELECT * FROM lab WHERE Lab_Id='$L_ID'");
  if($rowl=mysql_fetch_array($resultl))
  {  
    echo '<td>';
		echo $rowl['Lab_Type'];
		echo '</td>';	
  }
  else
  {
    echo '<td>';
		echo '';
		echo '</td>';	 
  }
		}
		else
		{
		if($val=="School_Id")
{
$get_Sch_name=mysql_query("SELECT * FROM school WHERE School_Id='".$valu."'");
if($rs=mysql_fetch_array($get_Sch_name))
{
$Name=$rs['Name'];
}
echo '<td>';
		echo $Name;
		echo '</td>';
}
else
{
            echo '<td>';
		echo $valu;
		echo '</td>';
		}
    	}
		}

	?>
	<td width="159"><?php
	 if($_SESSION['Access_Type']=="Teacher"||$_SESSION['Access_Type']=="Teacher in Charge")
	{
	 $NIC_Number=$_SESSION['NIC_Number'];
   $get_Sch=mysql_query("SELECT * FROM teacher WHERE T_NIC_Number='$NIC_Number'");
   if($rowsch=mysql_fetch_array($get_Sch))
{
   $Own_School_Id=$rowsch['School_Id'];
    	   $resultte=mysql_query("SELECT * FROM resource_details WHERE School_Id='$Own_School_Id'");
	if($resultte)
  {
  if(mysql_num_rows($resultte)!=0)
  {
  $_SESSION['errornotallo']="Sorry you are not allowed to view all details!";
  }
  }
  $n=mysql_num_rows($resultte);
	}
	}
	else if($_SESSION['Access_Type']=="Administrator")
	{
		$resultte=mysql_query("SELECT * FROM resource_details");
$n=mysql_num_rows($resultte);
	}
    echo "<div class='ctxt'><input type='text' size='5' name='$name' id='$groupcolumn'  onkeyup='GetCol(this.value,this.name,$rnum)' onclick='GetTBox($rnum,$n)'/></div>";
	$button="button".$rnum;
		echo "<div id='$button' class='sub_but'></div>";
	?></td>
   <?php
  echo '</tr>';
  }
  echo '</table>';
   if(mysql_num_rows($result)>=10)
   {
	 echo '</div>';
	 }
  }
   if($action=="group")
  {
  $l_val=count($Column_names)-1;
  	$gval=explode(",",$_SESSION['gvals']);
	$Column_names=explode(",",$_SESSION['Column_name']);
    $gval=explode(",",$_SESSION['gvals']);
  if($_SESSION['Access_Type']=="Administrator")
  {  
      $res_que="SELECT * FROM resource_details WHERE ";
  for($j=0;$j<count($Column_names);$j++)
  {
  $Col_name=$Column_names[$j];
  
     $res_que=$res_que.$Col_name."='".$gval[$j]."'";
   if($j!=(count($Column_names)-1))
  {
  $res_que=$res_que." AND ";
  }
  }
	 $resultgro=mysql_query($res_que);
	 $Exc_que=$res_que;
   $number_of_rows=mysql_num_rows($resultgro);
  }
 else if($_SESSION['Access_Type']=="Teacher in Charge"||$_SESSION['Access_Type']=="Teacher")
  {
   $NIC_Number=$_SESSION['NIC_Number'];
   $get_Sch=mysql_query("SELECT * FROM teacher WHERE T_NIC_Number='$NIC_Number'");
   if($rowsch=mysql_fetch_array($get_Sch))
{
   $Own_School_Id=$rowsch['School_Id'];
   }
      $res_que="SELECT * FROM resource_details WHERE ";
for($j=0;$j<count($Column_names);$j++)
  {
  $Col_name=$Column_names[$j];
   
  $res_que=$res_que.$Col_name."='".$gval[$j]."'";
  
  if($j!=(count($Column_names)-1))
  {
  $res_que=$res_que." AND ";
  }
  if($j==(count($Column_names)-1))
  {
  $res_que=$res_que." AND School_Id='".$Own_School_Id."'";
  }
  }
   $resultgro=mysql_query($res_que);
   $Exc_que=$res_que;
   $number_of_rows=mysql_num_rows($resultgro);
 }
    if($gval[$l_val]!="")
  {
  	if(mysql_num_rows($resultgro)>=10)
   {
 echo '<div style="height:410px; overflow-Y:scroll; ">';
 }
    echo '<table width="937" border="1" class="tablefontv">';
echo '<tr bgcolor="#6AB5FF">';
		if($_SESSION['Access_Type']=="Administrator"||$_SESSION['Access_Type']=="Teacher in Charge")
	{
echo '<td width="39"></td>
<td width="39"></td>';
}
$cnamearray=explode(',',$colnamearray);
     for($cv=0;$cv<count($cnamearray);$cv++)
	{
	 $val=$cnamearray[$cv];
	if($val=="Resource_Id")
	{
	$Re_ID=$row[$val];
	}
	  $th_cname= str_replace("_"," ",$val);
		
	$valu=$row[$val];
  echo '<td>';
		if($val=="School_Id")
  {
    $cnu=$cv+1;
	echo "(".$cnu.")School Name";
  }
  else if($val=="Lab_Id")
  {
    $cnu=$cv+1;
	echo "(".$cnu.")Lab Type";
  }
  else
  {
	$cnu=$cv+1;
	echo "(".$cnu.")".$th_cname;
  }
		echo '</td>';
   
	}
	echo '<td width="159">Column No</td>';
	echo '</tr>';
  $Column_names=explode(",",$_SESSION['Column_name']);
    $gval=explode(",",$_SESSION['gvals']);
	if($_SESSION['Column_name']!="")
  {
   while($row=mysql_fetch_array($resultgro))
  {
  $rnum=$rnum+1;    
$s=$row['Serial_Number'];
$r=$row['Resource_Id'];
$delVerification="delVerification".$rnum;
$name=$s.",".$r;
?>
<tr bgcolor="#999999"><?php echo "<form action='#' method='post'>";
   	if($_SESSION['Access_Type']=="Administrator"||$_SESSION['Access_Type']=="Teacher in Charge")
	{	?>
<td width="39">
<a href='?action=edit&Serial_Number=<?php echo $s; ?>&Resource_Id=<?php echo $r; ?>'><img src="../images/edit.png"/></a></td>
<td width="39"><?php echo "<input type='submit' id='$name' name='dele' onclick='DeleteVerification($rnum,this.id)' class='submitdelete' value=''/>";?></td>
	<?php
}	
	$cnamearray=explode(',',$colnamearray);
	for($cv=0;$cv<count($cnamearray);$cv++)
	{
	$val=$cnamearray[$cv];
	if($val=="Resource_Id")
	{
	$Re_ID=$row[$val];
	}
	if($val=="Lab_Id")
	{
	$L_ID=$row[$val];
	}
	  $th_cname= str_replace("_"," ",$val);
		$valu=$row[$val];
        	if($cv==9)
		{
		$resultnet=mysql_query("SELECT * FROM resource WHERE Resource_Id='$Re_ID'");
  if($rownet=mysql_fetch_array($resultnet))
  {  
    echo '<td>';
		echo $rownet['Resource_Type'];
		echo '</td>';	
  }
  else
  {
    echo '<td>';
		echo '';
		echo '</td>';	 
  }
		}
		else if($cv==7)
		{
		$resultl=mysql_query("SELECT * FROM lab WHERE Lab_Id='$L_ID'");
  if($rowl=mysql_fetch_array($resultl))
  {  
    echo '<td>';
		echo $rowl['Lab_Type'];
		echo '</td>';	
  }
  else
  {
    echo '<td>';
		echo '';
		echo '</td>';	 
  }
		}
		else
		{
		if($val=="School_Id")
{
$get_Sch_name=mysql_query("SELECT * FROM school WHERE School_Id='".$valu."'");
if($rs=mysql_fetch_array($get_Sch_name))
{
$Name=$rs['Name'];
}
echo '<td>';
		echo $Name;
		echo '</td>';
}
else
{
            echo '<td>';
		echo $valu;
		echo '</td>';
		}
    	}
   
	}
	?>
	<td width="90">
	<?php
	 if($_SESSION['Access_Type']=="Teacher in Charge"||$_SESSION['Access_Type']=="Teacher")
	{
	$NIC_Number=$_SESSION['NIC_Number'];
   $get_Sch=mysql_query("SELECT * FROM teacher WHERE T_NIC_Number='$NIC_Number'");
   if($rowsch=mysql_fetch_array($get_Sch))
{
   $Own_School_Id=$rowsch['School_Id'];
	   $resultte=mysql_query("SELECT * FROM resource_details WHERE School_Id='$Own_School_Id'");
	   if($resultte)
  {
  if(mysql_num_rows($resultte)!=0)
  {
  $_SESSION['errornotallo']="Sorry you are not allowed to view all details!";
  }
  }
  $n=mysql_num_rows($resultte);
	}
	}
	else if($_SESSION['Access_Type']=="Administrator")
	{
		$resultte=mysql_query("SELECT * FROM resource_details");
	  $n=mysql_num_rows($resultte);
	}
    echo "<div class='ctxt'><input type='text' size='5' name='$name' id='$groupcolumn'  onkeyup='GetCol(this.value,this.name,$rnum)' onclick='GetTBox($rnum,$n)'/></div>";
	$button="button".$rnum;
		echo "<div id='$button' class='sub_but'></div>";
	?></td>
    <?php
  echo '</tr>';
  }
  }
  echo '</table>';
  if(mysql_num_rows($resultgro)>=10)
   {
  echo '</div>';
  }
  }
else
  {
  	if(mysql_num_rows($result)>=10)
   {
 echo '<div style="height:410px; overflow-Y:scroll; ">';
 }
    echo '<table width="937" border="1" class="tablefontv">';
   echo '<tr bgcolor="#6AB5FF">';
		if($_SESSION['Access_Type']=="Administrator"||$_SESSION['Access_Type']=="Teacher in Charge")
	{
echo '<td width="39"></td>
<td width="39"></td>';
}
$cnamearray=explode(',',$colnamearray);
     for($cv=0;$cv<count($cnamearray);$cv++)
	{
	 $val=$cnamearray[$cv];
	if($val=="Resource_Id")
	{
	$Re_ID=$row[$val];
	}
	  $th_cname= str_replace("_"," ",$val);
		
	$valu=$row[$val];
  echo '<td>';
		if($val=="School_Id")
  {
    $cnu=$cv+1;
	echo "(".$cnu.")School Name";
  }
  else if($val=="Lab_Id")
  {
    $cnu=$cv+1;
	echo "(".$cnu.")Lab Type";
  }
    else
  {
	$cnu=$cv+1;
	echo "(".$cnu.")".$th_cname;
  }
		echo '</td>';
   
	}
	echo '<td width="159">Column No</td>';
	echo '</tr>';
  while($row=mysql_fetch_array($result))
  {
	  $rnum=$rnum+1;
    
$s=$row['Serial_Number'];
$r=$row['Resource_Id'];
$delVerification="delVerification".$rnum;
$name=$s.",".$r;
?>
<tr bgcolor="#999999"><?php echo "<form action='#' method='post'>";
   	if($_SESSION['Access_Type']=="Administrator"||$_SESSION['Access_Type']=="Teacher in Charge")
	{	?>
<td width="39">
<a href='?action=edit&Serial_Number=<?php echo $s; ?>&Resource_Id=<?php echo $r; ?>'><img src="../images/edit.png"/></a></td>
<td width="39"><?php echo "<input type='submit' id='$name' name='dele' onclick='DeleteVerification($rnum,this.id)' class='submitdelete' value=''/>";?></td>
	<?php 
	}
	$cnamearray=explode(',',$colnamearray);
	for($cv=0;$cv<count($cnamearray);$cv++)
	{
	$val=$cnamearray[$cv];
	if($val=="Resource_Id")
	{
	$Re_ID=$row[$val];
	}
		if($val=="Lab_Id")
	{
	$L_ID=$row[$val];
	}
	  $th_cname= str_replace("_"," ",$val);
		$valu=$row[$val];
		if($cv==9)
		{
		$resultnet=mysql_query("SELECT * FROM resource WHERE Resource_Id='$Re_ID'");
  if($rownet=mysql_fetch_array($resultnet))
  {  
    echo '<td>';
		echo $rownet['Resource_Type'];
		echo '</td>';	
  }
  else
  {
    echo '<td>';
		echo '';
		echo '</td>';	 
  }
		}
		else if($cv==7)
		{
		$resultl=mysql_query("SELECT * FROM lab WHERE Lab_Id='$L_ID'");
  if($rowl=mysql_fetch_array($resultl))
  {  
    echo '<td>';
		echo $rowl['Lab_Type'];
		echo '</td>';	
  }
  else
  {
    echo '<td>';
		echo '';
		echo '</td>';	 
  }
		}
		else
		{
		if($val=="School_Id")
{
$get_Sch_name=mysql_query("SELECT * FROM school WHERE School_Id='".$valu."'");
if($rs=mysql_fetch_array($get_Sch_name))
{
$Name=$rs['Name'];
}
echo '<td>';
		echo $Name;
		echo '</td>';
}
else
{
            echo '<td>';
		echo $valu;
		echo '</td>';
		}
    	}
		}

	?>
	<td width="159"><?php
	 if($_SESSION['Access_Type']=="Teacher"||$_SESSION['Access_Type']=="Teacher in Charge")
	{
	 $NIC_Number=$_SESSION['NIC_Number'];
   $get_Sch=mysql_query("SELECT * FROM teacher WHERE T_NIC_Number='$NIC_Number'");
   if($rowsch=mysql_fetch_array($get_Sch))
{
   $Own_School_Id=$rowsch['School_Id'];
    	   $resultte=mysql_query("SELECT * FROM resource_details WHERE School_Id='$Own_School_Id'");
	   if($resultte)
  {
  if(mysql_num_rows($resultte)!=0)
  {
  $_SESSION['errornotallo']="Sorry you are not allowed to view all details!";
  }
  }
  $n=mysql_num_rows($resultte);
	}
	}
	else if($_SESSION['Access_Type']=="Administrator")
	{
		$resultte=mysql_query("SELECT * FROM resource_details");
	 $n=mysql_num_rows($resultte);
	}
    echo "<div class='ctxt'><input type='text' size='5' name='$name' id='$groupcolumn'  onkeyup='GetCol(this.value,this.name,$rnum)' onclick='GetTBox($rnum,$n)'/></div>";
	$button="button".$rnum;
		echo "<div id='$button' class='sub_but'></div>";
	?></td>
   <?php
  echo '</tr>';
  }
   echo '</table>';
  if(mysql_num_rows($result)>=10)
   {
  echo '</div>';
  }
  }
   }
   $Column_names=explode(",",$_SESSION['Column_name']);
   if(count($Column_names)>0&&$_SESSION['Column_name']!="")
  {
   ?>
   <br/>
   <form action="#"/>
   <input type="submit" name="groupback" class="groupback" value=""/></form>
   <?php
   }
   echo "</form>";
}
}
 else
	   {
	   $_SESSION['errornorow']="Sorry there is no result to view!";
	   }
	   }
  }
  if($_GET['action']!="edit"&&$action!="delete")
  {
   if($number_of_rows>0)
   {
  $Exc_quer=str_replace("'","@",$Exc_que);
  echo "<form action='../exportreport.php' method='post'><input type='submit' name='ToExcel' class='print' value=''/><input type='hidden' value='$Exc_quer' name='query'/><input type='hidden' value='resource_details' name='Exc_table_name'/></form>";
  }
  }
  ?>
<font class="err">
<?php
 if(isset($_SESSION['errornotallo']))
{
echo '<img src="../images/alert.jpg" width="12" height="12"/>';
echo $_SESSION['errornotallo'];
unset($_SESSION['errornotallo']);
}
if(isset($_SESSION['errornorow']))
{
echo '<img src="../images/alert.jpg" width="12" height="12"/>';
echo $_SESSION['errornorow'];
unset($_SESSION['errornorow']);
}
	if(isset($_SESSION['value_empty']))
{
echo '<img src="../images/alert.jpg" width="12" height="12"/>';
echo $_SESSION['value_empty'];
unset($_SESSION['value_empty']);
}
if($action=="delete")
{
	if(isset($_SESSION['del']))
{
echo '<img src="../images/alert.jpg" width="12" height="12"/>';
echo $_SESSION['del'];
unset($_SESSION['del']);
}
}
if(isset($_SESSION['groupbyempty']))
{
echo '<img src="../images/alert.jpg" width="12" height="12"/>';
echo $_SESSION['groupbyempty'];
unset($_SESSION['groupbyempty']);
}
	if(isset($_POST['Go']))
	 {
	if(isset($_SESSION['up']))
{
echo '<img src="../images/alert.jpg" width="12" height="12"/>';
echo $_SESSION['up'];
unset($_SESSION['up']);
}
}
	?>
	</font>
	  </div>
  </div>
</div>
<div id="sidebar">
<br/>
<div id="partners" class="boxed">
			<h2 class="title">RESOURCES</h2>
            </div>
            <?php
include_once "menu.php";
?>
 <?php
include_once "../footer.php";
}
?>

</body>
</html>